package com.heima.wemedia.feign;


import apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojos.ApUser;
import com.heima.wemedia.service.WmSensitiveService;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1")
public class WemediaClient implements IWemediaClient {
    @Autowired
    private WmUserService wmUserService;
    @Autowired
    private WmSensitiveService wmSensitiveService;

    @PostMapping("/user/auth")
    public ResponseResult WeUserKeep(@RequestBody ApUser apUser) {
        return wmUserService.weUserKeep(apUser);
    }

    /**
     * 根据authorIf查询WmUser
     * @param authorId
     * @return
     */
    @Override
    @PostMapping("/user")
    public ResponseResult getWmUserById(@RequestBody Integer authorId) {
        return wmUserService.getWmUserById(authorId);
    }

    /**
     * 查询敏感词
     */
    @Override
    @GetMapping("/sensitive")
    public ResponseResult isSensitivePass(String content) {
        return ResponseResult.okResult(wmSensitiveService.isSensitivePass(content));
    }
}
